<?php
namespace app\index\controller;
use think\Model;
use think\Db;

class Gpdata extends Model{ 
      //自定义初始化
    protected function initialize()
    {
        //需要调用`Model`的`initialize`方法
        parent::initialize();
        //TODO:自定义的初始化
    }


//http://localhost:8888/tp5/public/index/gpdata/index?gp_no=603938
    public function index(){
    	$gpdata = new Gpdata();
        $gpno = $_REQUEST["gp_no"];
        $data = $gpdata->where('gp_no', $gpno)
                        //->order('id', 'desc')
                        ->order('id', 'asc')
                        ->select();
    	$jsonData = array('data' => $data); 
    	return json_encode($jsonData);
    }
}
?>